<%-- 
    Document   : loginAction
    Created on : Dec 21, 2009, 1:38:49 AM
    Author     : joselito
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="br.com.zumbits.avd.mysql.*" %>
<%@page import="java.util.ArrayList" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link rel="stylesheet" type="text/css" href="stylesheets/login.css" />
        
    </head>
    <body>
        <%
            String userSession = (String) session.getAttribute("user");

            try {
                Mysql mysql = new Mysql();
                mysql.connect();
                UserSQL userSQL = new UserSQL(mysql);

                String login = request.getParameter("login");
                String password = request.getParameter("password");

                if (userSQL.select(login, password).size() > 0) {
                    session.setAttribute("user", login);
        %>
            <input type="hidden" id="user" value="<% out.print(login); %>"/>
            <div id="log">
                Log aki
                <a href="#" onclick="loadLog(); onLoadLogin();">ver log</a>
            </div>
        <%
                } else {
                    out.println("pra q q tu erra esse login? =p");
                }
            } catch (Exception ex) {
                //response.sendRedirect("http://localhost:8080/server-web/");
            }
            
        %>
    </body>
</html>
